<script type="text/javascript" src="javascripts/jquery.cycle.all.js"></script>
<div class="content">
  <div class="left">
    <style type="text/css">
      .cycle_img{ width:448px;height:232px;  position:relative; overflow:hidden; }
      .cycle_img img{ width:446px;}
      #nav{ position:absolute; z-index:100; right:0; bottom:0; }
      .activeSlide{color:red;}
      #nav a{ background:url(/images/nav_bg.gif) no-repeat right;padding:0px 5px;  border:solid 1px #ccc;margin-left:1px;}

    </style>
    <div class="cycle_img">
      <div id="cycleimgs">
        <% cache :controller=>"cycles",:action=>"list" do %>
          <% for item in Cycle.all  %>
            <% content_tag(:div)  do %>
              <%= link_to(image_tag("newsimgs/"+item.img,:align=>"center"),item.link) %>
            <% end %>
          <% end %>
        <% end %>
      </div>
    </div>
    <div class="index_top_left">
      <% cache  :controller=>"advertisements",:action=>"list",:part=>"index_top_left" do %>
        <%=display_advertisement("IndexTopLeft") %>
      <% end %>
    </div>
    <div class="top_click_pros">
      <% cache "top_click_pros",10.minutes.from_now.to_s do %>
        <% for pro in top_click_pros %>
          <%= link_to(image_tag("proimages/"+(pro.image_name? ? pro.image_name.sub(".","_s."):"noimage.png"),:align=>"center"),product_path(pro),:title=>pro.name) %>
        <% end %>
      <% end %>
    </div>
  </div>

  <div class="right">
    <div class="index_news">
      <table width="100%">
        <tr>
          <td width="140" valign="top">
            <ul class="index_top_img_news">
              <% cache  :controller=>"articles",:action=>"forindex",:part=>"top_3_news" do %>
                <% for n in top_3_news -%>
                  <li><%=link_to image_tag(n.image_name ? "newsimgs/#{n.image_name}":"noimage.png",:align=>"center"),article_category_article_path(n.article_category_id,n.id) %>
                    <p><%=link_to truncate(n.title,:length=>12),article_category_article_path(n.article_category_id,n.id),:title=>n.title %></p>
                  </li>
                <% end %>
              <% end %>
            </ul>
          </td>
          <td valign="top">
            <ul class="index_top_news">
              <% cache  :controller=>"articles",:action=>"forindex",:part=>"top_news" do %>
                <% for n1 in top_news -%>
                  <li><div class="left"><%=link_to truncate(n1.title,:length=>18),article_category_article_path(n1.article_category_id,n1.id) %></div><div class="right"><%=n1.created_at.strftime("%m/%d")%></div></li>
                <% end %>
              <% end %>

            </ul>
          </td>
        </tr>
      </table>
    </div>

  </div>
</div>
<div class="content">
  <% cache "cycle_tuangou_pros",10.minutes.from_now.to_s  do %>
    <div class="tuangou_marquee left">
      <%=render :partial=>"cycle_tuangou",:object=>get_top_tuangou_pros %>
    </div>
  <% end %>
  <div class="right">

    <%=render :partial=>"reviews/newest_review" %>

  </div>
</div>
<% cache  :controller=>"advertisements",:action=>"list",:part=>"index_middle_middle" do %>
  <%=display_advertisement("IndexMiddleMiddle",true) %>
<% end %>
<% cache  :controller=>"products",:action=>"list",:part=>"for_index" do %>
  <div class="content">
    <div class="left">
      <div id="kongtiao">
        <ul>
          <li><a href="#tejia-10">特价空调</a></li>
          <li><a href="#tuijian-12">推荐空调</a></li>
          <li><a href="#jingpin-9">精品空调</a></li>
        </ul>
        <div id="tejia-10">
          <ul>
            <%=render :partial=>"item",:collection=>tejia_pros %>
          </ul>
        </div>
        <div id="tuijian-12" >
          <ul>
            <%=render :partial=>"item",:collection=>tuijian_pros %>
          </ul>
        </div>
        <div id="jingpin-9">
          <ul>
            <%=render :partial=>"item",:collection=>jingpin_pros %>
          </ul>
        </div>
      </div>
    </div>
  <% end %>
  <div class="right">
    <% cache "hotnews",10.minutes.from_now.to_s do %>
      <%= render :partial=>"news_part",:object=>hotnews,:locals=>{:display_name=>"热点新闻"} %>
    <% end %>
    <% cache  :controller=>"advertisements",:action=>"list",:part=>"index_middle_right" do %>
      <%=display_advertisement("IndexMiddleRight",true) %>
    <% end %>
  </div>
</div>
<div class="content">
  <div class="cate_article_part">
    <% cache  :controller=>"articles",:action=>"forindex",:part=>"cate_news" do %>
      <% for cate_new in cates %>
        <%=render :partial=>"cate_part",:object=>cate_new%>
      <% end %>
    <% end %>
  </div>
  <div class="right">
    <% cache "hot_tuangou",10.minutes.from_now.to_s do %>
      <%=render :partial=>"tuangou_part",:object=>tuangou_top_click,:locals=>{:display_name=>"热点团购"}%>
    <% end %>
    <% cache :controller=>"tuangou_pros",:action=>"list",:part=>"top_tuangou" do %>
      <%=render :partial=>"tuangou_part",:object=>tuangou_top_new,:locals=>{:display_name=>"最新团购"}%>
    <% end %>

  </div>
</div>

<script type="text/javascript">
  $(document).ready(function(){
    $("#kongtiao").tabs({event: 'mouseover'});
    $('#cycleimgs')
    .after('<div id="nav">')
    .cycle({
      fx:     'fade',
      speed:  'fast',
      timeout: 3000,
      pager:  '#nav'
      //pagerAnchorBuilder:function(i,el){
      // return $('<a href="#"><img src="images/beach'+(i+1)+'.jpg"/></a>');
      // }
    });
    $("#nav a").focus(function(){this.blur();});


  });
</script>

<% content_for :links  do %>
  <% cache :controller=>"links",:action=>"list",:part=>"for_index" do %>
    <% @links= Link.all(:conditions=>"auditing_state=true",:order=>"link_order") %>
    <div class="links">
      <% for link in @links %>
        <%= link_to image_tag(link.img ? "newsimgs/#{link.img}":"no_images.png",:size=>"100x31",:align=>"absmiddle"),link.address,:title=>link.name %>
      <% end %>
      <%= link_to "添中链接",new_link_path %>
    </div>
  <% end %>
<% end %>

  <%=render :partial=>"products/sub_menu",:object=>2 %>
